<%--
 *  File:    FavoriteMenu.jsp
 *  @Author: Rael Zhu
 *  Date:    Tuesday, October 14th, 2003

 *  Copyright (C) 2000 - 2001 Oval Technologies, Inc.
 *  All rights reserved. 
 *
 *  This software is the confidential and proprietary information of Oval 
 *  Technologies, Inc. ("Confidential Information").  You shall not
 *  disclose such Confidential Information and shall use it only in
 *  accordance with the terms of the license agreement you entered into
 *  with Oval.
--%>

<%@ include file="/inc/SessionTimeout.inc"%>

<%@ page language="java" %>
<%@ page import="java.util.*" %>
<%@ page import="org.apache.log4j.Category" %>
<%@ page import="com.oval.util.*" %>
<%@ page contentType = "text/html;charset=UTF-8" %>

<%@ taglib uri="/WEB-INF/PageFlow.tld" prefix="PageFlow" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/custom.tld" prefix="custom" %>

<%
  Category cat = Category.getInstance("jsp.FavoriteMenu");
  String strModuleName = "UPM";
  String privilegeCode = "Z0504";
  String strTableName = "";
%>

<%@include file="/inc/PageDefault.inc"%>
<%@include file="/inc/Security.inc"%>
<%@include file="/inc/FrmDefault.inc"%>
<%@include file="/inc/LocationDefault.inc"%>

<html>
<head>
<title>FavoriteMenu</title>

<PageFlow:CheckPageFlow pageName="favoritepackagesummary"/>

<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" href="../../css/<%= strLanguageCode %>/main.css" type="text/css">
<script language="JavaScript" src="../../css/<%= strLanguageCode %>/script.js"></script>
<script language="JavaScript" src="../../js/FuncLib.js"></script>
<script language="JavaScript" src="../../js/ScriptLib.js"></script>
<script language="JavaScript">

function page_add()
{
  <%
    Vector packageSummary = (Vector)pageContext.getAttribute("favoritepackage");
    if (packageSummary == null) packageSummary = new Vector();
    
    if (packageSummary.size() == 0)
    {
  %>
    if (!confirm("<%= message.getMessageDesc("ADD_DEFAULT_PACK") %>")) return;
  <%
    }
  %>
  
  if (!checkForm(document.frm)) return;
  
  document.all.numrows.value = 2;
  
  document.frm.actionname.value = "add";
  document.frm.target = "_self";
  isRunning = true;
  document.frm.submit();
}

function page_save()
{
  document.frm.actionname.value = "save";
  document.frm.target = "_self";
  isRunning = true;
  document.frm.submit();
}

function page_delete()
{
  if (nullChecked(document.frm.deleteids))
  {
    alert('<%= message.getMessageDesc("MUST_SELECT_ONE_RECORD_TO_DEL") %>');
    return;
  }
  if (!confirm("<%= message.getMessageDesc("ARE_YOU_SURE_DEL") %>")) return;
  
  document.frm.actionname.value = "delete";
  document.frm.target = "_self";
  isRunning = true;
  document.frm.submit();
}

</script>
</head>
<body>

<form name="frm" method="post" action="../../Dispatcher">
  <input type="hidden" name="pagename" value="favoritepackagesummary">
  <input type="hidden" name="actionname">

<table width="100%" cellspacing="0" border="0" cellpadding="0">
  <tr><td  height="25" class="summary_top">
    <table width="100%" cellspacing="0">
      <tr> 
        <td class="td-blue" width="74%" height="41">
          <%@include file="/inc/PageLocation.inc" %>
        </td>
      </tr>
    </table>
  </td></tr>
  
  <tr><td> 
    <table width="100%" border="1" cellpadding="0" bordercolorlight="#999999" bordercolordark="#FFFFFF" cellspacing="0" align="center">
      <tr class="deepblue-left" > 
        <td width="27" class="title_center">&nbsp;</td>
        <td class="title_center" width="984"><%= label.getLabelName("L_FavoritePackage") %></td>
      </tr>
      
      <%
        String strClassType = "";
        boolean bIsDefault = true;
        
        int i = 0;
      %>
      
      <logic:iterate id="packageItem" collection="<%= packageSummary %>" indexId="columnId">
      <%
        if (columnId.intValue()%2 == 1)
        { strClassType = "td-listrom"; }
        else
        { strClassType = "none"; }
        
        if (bIsDefault)
        {
          bIsDefault = false;
      %>
      <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'">
        <td><input disabled id="iddefault" type="checkbox" class="normalradio"></td>
        <td><custom:write name="packageItem" property="labelname"/></td>
      </tr>
      <%
        }
        else
        {
          i = columnId.intValue();
      %>
      <tr onMouseOver="this.className='tr-over'" onMouseOut="this.className='<%=JspHelper.filterNull( strClassType )%>'">
        <td><input id="id<%=JspHelper.filterNull( columnId )%>" name="deleteids" type="checkbox" value="<custom:write name="packageItem" property="privilegeid"/>" class="normalradio"></td>
        <td>
          <custom:text name="packageItem" property="labelname" size="15" command="notnull" module="UPM" label="L_FavoritePackage" needMLC="true" isFirstMLC="true" multiLangType="labelname" entityId="privilegeid" contentId="favoritemenuid" colIndex="<%= columnId %>"/>
          <a onclick='popup("../../common/Lang.jsp?<%= OvalTools.randomURL() %>&form=frm&module=UPM&mlctype=L_FavoritePackage&nativelanguage=need&schema=ovfavoritepackage&qlname=selectbyprivilegeid&entityid=<custom:write name="packageItem" property="privilegeid"/>&entitytype=labelname&contentid=favoritemenuid&colindex=<%=JspHelper.filterNull( columnId )%>", "newwindow", "height=250, width=320,top=100,left=100,toolbar=n0, menubar=no, scrollbars=no, resizable=no, location=no, status=no");'><custom:button type="3" label="L_Ln" imgsrc="ln.gif" border="0"/></a>
        </td>
      </tr>
      <%
        }
      %>
      </logic:iterate>
      
      <input type="hidden" name="numrows" value="<%=JspHelper.filterNull( (i + 1)*2 )%>">
      
      <tr>
        <td>&nbsp;</td>
        <td>
          <custom:text property="labelname" size="15" command="notnull" module="UPM" label="L_FavoritePackage" needMLC="true" isFirstMLC="true" multiLangType="labelname" entityId="privilegeid" contentId="favoritemenuid" colIndex="0"/>
          <a onclick="popup('../../common/Lang.jsp?<%= OvalTools.randomURL() %>&form=frm&module=UPM&mlctype=L_FavoritePackage&nativelanguage=need&schema=ovfavoritepackage&qlname=&entityid=&entitytype=labelname&contentid=favoritemenuid&colindex=0', 'newwindow', 'height=250, width=320,top=100,left=100,toolbar=n0, menubar=no, scrollbars=no, resizable=no, location=no, status=no');"><custom:button type="3" label="L_Ln" imgsrc="ln.gif" border="0"/></a>
        </td>
        
        <input type="hidden" name="entityid" value="<%=JspHelper.filterNull( (Integer)((HashMap)session.getAttribute("userinfo")).get("userid") )%>">
        <input type="hidden" name="type" value="1">
      </tr>
      
      </table>
      
      <table width="100%" cellspacing="0" cellpadding="0">
        <tr> 
          <td class="summary_top"></td>
        </tr>
        <tr> 
          <td class="td_center">
            <a onClick="page_add()"><custom:button type="1" label="L_Add" imgsrc="add.gif" border="0" style="width:60"/></a>
            <a onClick="page_save()"><custom:button type="1" label="L_Save" imgsrc="save.gif" border="0" style="width:60"/></a>
            <a onClick="page_delete()"><custom:button type="1" label="L_Delete" imgsrc="delete.gif" border="0" style="width:60"/></a>
          </td>
        </tr>
      </table>
    </td>
  </tr>
</table>
</form>
</body>
</html>
